home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / gnu / fpu881 / src6.zoo / casin.c < prev    next >
C/C++ Source or Header  |  1991-09-24  |  2KB  |  80 lines

  1. /************************************************************************
  2.  *                                    *
  3.  *                N O T I C E                *
  4.  *                                    *
  5.  *            Copyright Abandoned, 1987, Fred Fish        *
  6.  *                                    *
  7.  *    This previously copyrighted work has been placed into the    *
  8.  *    public domain by the author (Fred Fish) and may be freely used    *
  9.  *    for any purpose, private or commercial.  I would appreciate    *
  10.  *    it, as a courtesy, if this notice is left in all copies and    *
  11.  *    derivative works.  Thank you, and enjoy...            *
  12.  *                                    *
  13.  *    The author makes no warranty of any kind with respect to this    *
  14.  *    product and explicitly disclaims any implied warranties of    *
  15.  *    merchantability or fitness for any particular purpose.        *
  16.  *                                    *
  17.  ************************************************************************
  18.  */
  19.  
  20.  
  21. /*
  22.  *  FUNCTION
  23.  *
  24.  *    casin   complex double precision arc sine
  25.  *
  26.  *  KEY WORDS
  27.  *
  28.  *    casin
  29.  *    machine independent routines
  30.  *    complex functions
  31.  *    math libraries
  32.  *
  33.  *  DESCRIPTION
  34.  *
  35.  *    Computes double precision complex arc sine of
  36.  *    a double precision complex argument.
  37.  *
  38.  *  USAGE
  39.  *
  40.  *    COMPLEX casin (z)
  41.  *    COMPLEX z;
  42.  *
  43.  *  PROGRAMMER
  44.  *
  45.  *    Fred Fish
  46.  *    Tempe, Az 85281
  47.  *    (602) 966-8871
  48.  *
  49.  *  INTERNALS
  50.  *
  51.  *    Computes complex arc sine of z = x + j y from:
  52.  *
  53.  *        casin(z) = -j * clog(csqrt(1-z*z) + j*z)
  54.  *
  55.  */
  56.  
  57. #include <stdio.h>
  58. #include <pmluser.h>
  59. #include "pml.h"
  60.  
  61.  
  62. COMPLEX casin (z)
  63. COMPLEX z;
  64. {
  65.     COMPLEX temp;
  66.     extern COMPLEX csqrt (), clog (), cmult ();
  67.  
  68.     temp = cmult (z, z);
  69.     temp.real = 1.0 - temp.real;
  70.     temp.imag = -temp.imag;
  71.     temp = csqrt (temp);
  72.     temp.real -= z.imag;
  73.     temp.imag += z.real;
  74.     temp = clog (temp);
  75.     z.real = temp.imag;
  76.     z.imag = -temp.real;
  77.  
  78.     return (z);
  79. }
  80.